package geez.widget;

import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.user.client.ui.PushButton;

public class GPushButton extends PushButton implements GFocusable, GClickable {

    public GPushButton id(String id) {
        Geez.withNameAndId(this, id);
        return this;
    }

    public GPushButton css(String cssClass, String... optionalClasses) {
        Geez.withStyle(this, cssClass, optionalClasses);
        return this;
    }

    public GPushButton show() {
        setVisible(true);
        return this;
    }

    public GPushButton hide() {
        setVisible(false);
        return this;
    }

    public GPushButton tabIndex(int index) {
        setTabIndex(index);
        return this;
    }

    public GPushButton add(FocusHandler handler) {
        addFocusHandler(handler);
        return this;
    }

    public GPushButton add(BlurHandler handler) {
        addBlurHandler(handler);
        return this;
    }

    public GPushButton enable() {
        setEnabled(true);
        return this;
    }

    public GPushButton disable() {
        setEnabled(false);
        return this;
    }

    public GPushButton add(ClickHandler handler) {
        addClickHandler(handler);
        return this;
    }

    public GPushButton focus() {
        setFocus(true);
        return this;
    }
}
